from django.db.models import Count
from django.shortcuts import render,redirect

from article.models import CategoryClass, Article, ArticleToTag, Comment, CategoryTag


# Create your views here.
def backend(request, *args, **kwargs):
    article_obj_all = Article.objects.filter(blog=request.user.blog)
    category_obj_all = CategoryClass.objects.filter(blog=request.user.blog)
    tag_obj_all = CategoryTag.objects.filter(blog=request.user.blog)
    comment_obj_all = Comment.objects.filter(user=request.user)

    return render(request, 'backend.html', locals())


def delete_backend(request,id):

    Article.objects.filter(id=id).delete()
    return redirect('/backend/backend/')
